﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Nollie.Utilities;

namespace Nollie.Storage.Database.Mapping
{
	public class CacheItemMapper
	{
		public static CacheItem MapToEntity(IDataReader reader)
		{
			var cacheItem = new CacheItem();
			cacheItem.Key = reader.GetString("Key");
			cacheItem.ExpiryDate = reader.GetDateTime("ExpiryDate");
			cacheItem.Value = SerializationHelper.DeserializeObject(reader.GetBytes("Value"));

			return cacheItem;
		}
	}
}
